-
-
Notifications
You must be signed in to change notification settings - Fork 437
Improve pair_plot
's reference_values
compatibility, flexibility, and documentation
#2438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve pair_plot
's reference_values
compatibility, flexibility, and documentation
#2438
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2438 +/- ##
==========================================
+ Coverage 86.79% 86.81% +0.02%
==========================================
Files 124 124
Lines 12998 12972 -26
==========================================
- Hits 11281 11262 -19
+ Misses 1717 1710 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I have further refactored and simplified the logic, especially for some of the consistency checks. Now, this is much more flexible. Consider the following example, where we use a mix of import arviz as az
import numpy as np
from arviz.labels import MapLabeller
print(az.__version__)
datadict = {
"a": np.random.randn(1, 100),
"b": np.random.randn(1, 100),
"c": np.random.randn(1, 100, 2),
"d": np.random.randn(1, 100, 2),
"x": np.random.randn(1, 100, 2, 1),
"y": np.random.randn(1, 100, 2, 1),
}
trace = az.convert_to_inference_data(datadict)
reference_values = {
"a": 0.0,
"b": 0.0,
"c": [-0.5, 0.5],
"d": [-0.5, 0.5],
"x": np.array([[-0.5], [0.5]]),
"y": np.array([[-0.5], [0.5]]),
}
var_name_map = {
"a": r"$\alpha$ ($\mu$m)",
"b": r"$\beta$ ($\mu$m)",
"x": "x (cm)",
"y": "y (cm)",
}
labeller = MapLabeller(var_name_map)
az.plot_pair(
trace,
var_names=["a", "b"],
reference_values=reference_values,
labeller=labeller,
show=True,
)
az.plot_pair(
trace,
var_names=["c", "d"],
reference_values=reference_values,
labeller=labeller,
show=True,
)
az.plot_pair(
trace,
var_names=["x", "y"],
reference_values=reference_values,
labeller=labeller,
combine_dims={"x_dim_0", "y_dim_0"},
show=True,
) |
I have updated the tests and documentation, as well as provided an example in the gallery. This should be ready to review once the checks have completed! @aloctavodia @amaloney |
pair_plot
reference values by var_name
instead of labeled var_name
pair_plot
's reference_values
compatibility, flexibility, and documentation
Thanks for the PR and clear description! I'll try and take a look soonish, sorry about the slow responses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good and you have checked all the boxes in the contributing guide/PR template on the first go, so thank you so much!
It looks like we do need to fix CI now which I'll do somewhere else but I'll merge this already.
Also, do you mind if I tag you on issues related to plot_pair references in arviz-plots. It doesn't have plot_pair yet but it should get it around early summer.
No problem. |
Description
This PR addresses #2437 by refactoring the
reference_values
handling inpair_plot
.reference_values
is much more flexible, as demonstrated below, and now properly works when combined withlabeller
andcombine_dims
. It also adds newreference_values
documentation and examples.Checklist
📚 Documentation preview 📚: https://arviz--2438.org.readthedocs.build/en/2438/